const express = require('express');
const router = express.Router();
const OrderController = require('../controllers/order.controller');
const auth = require('../middleware/auth');

// 所有订单路由都需要认证
router.use(auth);

// 创建订单
router.post('/', OrderController.createOrder);

// 获取用户订单列表
router.get('/', OrderController.getUserOrders);

// 获取订单详情
router.get('/:orderId', OrderController.getOrderDetail);

// 取消订单
router.patch('/:orderId/cancel', OrderController.cancelOrder);

module.exports = router; 